<%@page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="includes/head.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Phones</title>
</head>
<body>
	<f:view>
		<span id="whole-page-wrapper">
			<div id="wrapper" align="center">
			<%@include file="includes/header.jsp" %>
			<%@include file="includes/menu.jsp" %>	
					
				<div id="content">
					<div id="inner-content">
					
						<h3>Szczegółowe dane telefonu</h3>
						
							<div class="leftIndent50px">
								<h4> Model: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.model }"/></span><br>
								<h4> Cena: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.price }"/> zł</span><br>
								<h4> Aparat (skala 1-10): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.camera }"/></span><br>
								<h4> Wysokość: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.height }"/> mm</span><br>	
								<h4> Szerokość: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.width }"/> mm</span><br>
								<h4> Grubość: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.depth }"/> mm</span><br>
								<h4> Waga: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.weight }"/> g</span><br>
								<h4> Ilość kolorów wyświetlacza: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.colors }"/> milionów kolorów</span><br> 
								<h4> Rozdzielczość wyświetlacza: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.resolution }"/></span><br>
								<h4> Rozmiar wyświetlacza: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.screenSize }"/>"</span><br>
								<h4> Czas rozmów (2g): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.talkTime2g }"/> godzin</span><br>
								<h4> Czas rozmów (3g): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.talkTime3g }"/> godzin</span><br>
								<h4> Czas czuwania (2g): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.standBy2g }"/> dni</span><br>
								<h4> Czas czuwania (3g): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.standBy3g }"/> dni</span><br>
								<h4> Pamięć wbudowana: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.buildInMem }"/> GB</span><br>
								<h4> Pamięć RAM: </h4> 
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.ram }"/> MB</span><br>
								<h4> Maksymalny rozmiar karty pamięci: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.maxCardSize }"/> GB</span><br>
								<h4> Ilość aplikacji (skala 1-10): </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.nrOfApp }"/></span><br>
								<h4> Taktowanie procesora: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.procClock }"/> GHz</span><br>
								<h4> Na rynku od: </h4> <c:set var="year">${phone.selectedPhone.releaseDate}</c:set>
									<span class="leftIndent30px">
									<c:if test="${year.length() > 0}">
									${year.charAt(0)}
									</c:if>
									<c:if test="${year.length() > 1}">
									${year.charAt(1)}
									</c:if>
									<c:if test="${year.length() > 2}">
									${year.charAt(2)}
									</c:if>
									<c:if test="${year.length() > 3}">
									${year.charAt(3)}
									</c:if>
									r.</span><br>
								<h4> Popularność: </h4>
									<span class="leftIndent30px"><h:outputText value="#{phone.selectedPhone.popularity }"/>%</span><br>
								<h4> Łączność: </h4> <c:set var="hsdp">${phone.selectedPhone.getHsdpaitdAsString()}</c:set>
									<span class="leftIndent30px"> 
									<c:if test="${phone.selectedPhone.getHsdpaitdAsString().charAt(0)=='1'.charAt(0)}">
									HSDPA
									</c:if>
									<c:if test="${phone.selectedPhone.getHsdpaitdAsString().length()>1}" >
										<c:if test="${phone.selectedPhone.getHsdpaitdAsString().charAt(1)=='1'.charAt(0)}">
										HSUPA
										</c:if>
										<c:if test="${phone.selectedPhone.getHsdpaitdAsString().charAt(2)=='1'.charAt(0)}">
										HSPA
										</c:if>
										<c:if test="${phone.selectedPhone.getHsdpaitdAsString().charAt(3)=='1'.charAt(0)}">
										HSPA+
										</c:if>
										<c:if test="${phone.selectedPhone.getHsdpaitdAsString().charAt(4)=='1'.charAt(0)}">
										WIFI
										</c:if>
									</c:if>
									  </span><br>
								<h4> GorillaGlass: </h4> <c:set var="grl">${phone.selectedPhone.gorillaglass}</c:set>
									<span class="leftIndent30px">
									<c:if test="${grl.charAt(0)=='1'.charAt(0) }" >
										TAK
									</c:if>
									<c:if test="${grl.charAt(0)=='0'.charAt(0) }" >
										NIE
									</c:if>
									</span>
									<br>
								<h4> Wygląd: </h4>
									<span class="leftIndent30px">${phone.selectedPhone.design} </span><br>
								<h4> Autofocus: </h4> <c:set var="af">${phone.selectedPhone.autofocus}</c:set>
									<span class="leftIndent30px">
									<c:if test="${af.charAt(0)=='1'.charAt(0) }" >
										TAK
									</c:if>
									<c:if test="${af.charAt(0)=='0'.charAt(0) }" >
										NIE
									</c:if>
									</span>
									<br>
							</div>
							<c:if test="${sessionScope.user.loggedUser != null }">
							<c:if test="${sessionScope.user.loggedUser.type == 'Admin' }">
								<br>
								<h:form>
								<h:commandButton action="#{phone.removePhone }" value="Usuń telefon z bazy danych" />
								</h:form>
							</c:if>
							<c:if test="${sessionScope.user.loggedUser.type == 'User' }">
								<br>
								<h:form>
								<h:commandButton action="#{phone.addToCart }" value="Dodaj do koszyka" />

								</h:form>
							</c:if>
						</c:if>
					</div>
				</div>
				<%@include file="includes/footer.jsp" %>
			</div>
		</span>
	</f:view>
</body>
</html>